from django.db import models
from User.models import User


class Movie(models.Model):
    title = models.CharField(verbose_name='标题', max_length=50)
    description = models.CharField(verbose_name='电影描述', max_length=10000)
    create_time = models.DateTimeField(verbose_name='创建时间', auto_now_add=True)
    edit_time = models.DateTimeField(verbose_name="修改时间", auto_now=True)
    user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='电影所属用户')
    flag = models.IntegerField(verbose_name="是否已生成过分镜", default=0) # 0没生成过，1生成过


class StoryBoard(models.Model):
    index = models.IntegerField(verbose_name="第几幕场景", default=1, unique=True)
    description = models.CharField(verbose_name="分镜描述", max_length=10000)
    create_time = models.DateTimeField(verbose_name='创建时间', auto_now_add=True)
    edit_time = models.DateTimeField(verbose_name="修改时间", auto_now=True)
    movie = models.ForeignKey(Movie, on_delete=models.CASCADE, verbose_name='分镜所属电影')


class Picture(models.Model):
    file = models.CharField(blank=True, verbose_name="头像路径", max_length=512, default='')
    create_time = models.DateTimeField(verbose_name='创建时间', auto_now_add=True)
    edit_time = models.DateTimeField(verbose_name="修改时间", auto_now=True)
    story = models.ForeignKey(StoryBoard, on_delete=models.CASCADE, verbose_name='图片所属分镜')
